package com.zsx.shopping.auth.controller;

import com.zsx.shopping.auth.form.RegisterForm;
import com.zsx.shopping.auth.service.RegisterService;
import com.zsx.shopping.common.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RestController
@RequestMapping("/auth")
public class RegisterController {

    @Resource
    private RegisterService registerService;

    @PostMapping("/register")
    public R<Void> register(@Valid @RequestBody RegisterForm registerForm) {
        registerService.register(registerForm);
        return R.success();
    }
}
